home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / info-sys / www / tkhtml-2.3 / tkhtml-2 / tkHTML-2.3 / toolbar.tcl < prev    next >
Encoding:
Text File  |  1995-02-06  |  4.2 KB  |  153 lines

  1. #############################################
  2. # toolbar procedures
  3.  
  4. #############################################
  5. # this does everything for the toolbar
  6.  
  7. proc MkToolbar {} {
  8.     frame .toolbarframe -relief flat 
  9.     pack .toolbarframe -side top -fill both
  10.     MkToolbarPreview
  11.     MkToolbarFont
  12.     MkToolbarSize
  13.     MkToolbarWrap
  14. }
  15.  
  16. #############################################
  17. # preview button
  18.  
  19. proc MkToolbarPreview {} {
  20.     button .toolbarframe.preview -text "Preview" \
  21.         -font "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*" \
  22.         -command { SaveForPreview } -foreground Red
  23.     pack .toolbarframe.preview -side left -padx 8 -pady 2
  24. }
  25.  
  26. #############################################
  27. # linewrap widget
  28. proc MkToolbarWrap {} {
  29.     label .toolbarframe.wraplabel -text "Word wrap:" \
  30.         -font "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  31.     tixSelect .toolbarframe.sel -command {SetMainWrap} \
  32.         -font "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  33.     .toolbarframe.sel add word -text "Word" -width 6
  34.     .toolbarframe.sel add char -text "Char" -width 6
  35.     .toolbarframe.sel config -value {char}
  36. #    .toolbarframe.sel config -command {SetMainWrap}
  37.  
  38.     pack .toolbarframe.wraplabel -side left -padx 3 -pady 2
  39.     pack .toolbarframe.sel -side left -pady 2
  40.  
  41. }
  42.  
  43. #############################################
  44. # main window font widget
  45.  
  46. proc MkToolbarFont {} {
  47.     global textfont
  48. #    label .toolbarframe.fontlabel -text "Display font:" \
  49. #        -font "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  50.     tixCombobox .toolbarframe.font -type static \
  51.         -command SetMainFont -width 22\
  52.         -entryfont "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  53.  
  54.     .toolbarframe.font appendhistory "Courier"
  55.     .toolbarframe.font appendhistory "Helvetica"
  56.     .toolbarframe.font appendhistory "New Century Schoolbook"
  57.     .toolbarframe.font appendhistory "Times"
  58.     .toolbarframe.font appendhistory "Lucida"
  59.     .toolbarframe.font pick $textfont
  60.  
  61. #    pack .toolbarframe.fontlabel -side left -padx 3 -pady 2
  62.     pack .toolbarframe.font -side left -padx 2 
  63.  
  64. }    
  65.  
  66. #############################################
  67. # main window point size widget
  68.  
  69. proc MkToolbarSize {} {
  70.     global textsize
  71.     label .toolbarframe.sizelabel -text "Display font size:" \
  72.         -font "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  73.     tixCombobox .toolbarframe.size -type static \
  74.         -command SetMainSize \
  75.         -width 3 \
  76.         -entryfont "-adobe-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"
  77.  
  78.     .toolbarframe.size appendhistory "8"
  79.     .toolbarframe.size appendhistory "10"
  80.     .toolbarframe.size appendhistory "12"
  81.     .toolbarframe.size appendhistory "14"
  82.     .toolbarframe.size appendhistory "18"
  83.     .toolbarframe.size appendhistory "24"
  84.     .toolbarframe.size pick $textsize
  85.  
  86. #    pack .toolbarframe.sizelabel -side left -pady 2 -padx 3 
  87.     pack .toolbarframe.size -side left -pady 2
  88. }
  89.  
  90. #############################################
  91. # set word or character wrapping for main window
  92.  
  93. proc SetMainWrap {widget status} {
  94.     if {$widget == "word"} {
  95.         if {$status == 0} {
  96.             .textframe.vp.text config -wrap char
  97.         } else {
  98.             .textframe.vp.text config -wrap word
  99.         }
  100.     }
  101. }
  102.  
  103. #############################################
  104. # actually set the point size of the main window
  105.  
  106. proc SetMainSize {sizechoice} {
  107.     global textfont
  108.     global textsize
  109.     set textsize $sizechoice 
  110.     SetMainFontAndSize
  111. }
  112.  
  113.  
  114. #############################################
  115. # set the font size
  116.  
  117. proc SetMainFont {fontchoice} {
  118.     global textsize
  119.     global textfont
  120.     set textfont $fontchoice
  121.     SetMainFontAndSize
  122. }
  123.  
  124. #############################################
  125. # use values to set font and point
  126.  
  127. proc SetMainFontAndSize {} {
  128.     global textsize
  129.     global textfont
  130.     if {$textfont == "Times" } {
  131.         .textframe.vp.text config -font \
  132.         "-adobe-times-bold-r-normal-*-$textsize-*-*-*-*-*-*"
  133.     } elseif {$textfont == "Lucida" } {
  134.         .textframe.vp.text config -font \
  135.         "-b&h-lucida-medium-r-normal-*-$textsize-*-*-*-*-*-*-*"
  136.     } elseif {$textfont == "Courier" } {
  137.         .textframe.vp.text config -font \
  138.         "-adobe-courier-medium-r-normal-*-$textsize-*-*-*-*-*-*-*"
  139.     } elseif {$textfont == "Helvetica" } {
  140.         .textframe.vp.text config -font \
  141.         "-adobe-helvetica-medium-r-normal-*-$textsize-*-*-*-*-*-*-*"
  142.     } elseif {$textfont == "New Century Schoolbook"} { 
  143.         .textframe.vp.text config -font \
  144.         "-adobe-new century schoolbook-medium-r-normal-*-$textsize-*-*-*-*-*-*-*"
  145.     }
  146. }
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.